package com.hefu.virtuallife.ui.purchase.adapter;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hefu.virtuallife.R;
import com.hefu.virtuallife.ui.foods.adapter.PreItmePlanFoodAdapter;
import com.hefu.virtuallife.ui.foods.bean.CollectionSellersBean;
import com.hefu.virtuallife.ui.foods.bean.FoodInfoBean;
import com.hefu.virtuallife.ui.purchase.bean.HomePurchaseBean;
import com.hefu.virtuallife.ui.purchase.bean.PurchaseFoodsBean;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * creat_user: zhengzaihong
 * Email:1096877329@qq.com
 * creat_date: 2018/8/13
 * creat_time: 13:34
 * describe 家庭采购首页列表适配器
 **/

public class HomePurchaseAdapter extends BaseQuickAdapter<HomePurchaseBean, BaseViewHolder> {


    public HomePurchaseAdapter() {
        super(R.layout.itme_activity_home_purchase);
    }


    @Override
    protected void convert(BaseViewHolder holder, HomePurchaseBean shardAllBean) {

        RecyclerView recyclerView = holder.getView(R.id.recyclerView);
        recyclerView.setLayoutManager(new GridLayoutManager(mContext,3));
        PurchaseFoodAdapter purchasefoodadapter = new PurchaseFoodAdapter();
        recyclerView.setAdapter(purchasefoodadapter);

        List<PurchaseFoodsBean> listbean = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            PurchaseFoodsBean foodInfoBean = new PurchaseFoodsBean();
            listbean.add(foodInfoBean);
        }
        purchasefoodadapter.replaceData(listbean);


        holder.getView(R.id.ll_more).setOnClickListener(view -> {

        });


    }


    private CheckListenner listenner;

    public void setCheckListenner(CheckListenner listenner) {
        this.listenner = listenner;
    }

    public interface CheckListenner {
        void callBack(Set<CollectionSellersBean> data);
    }
}
